import React, { useEffect } from 'react';
import Form from './Form';
import Field from './Field';
import { useForm } from './useForm';

import Input from './components/Input';

export default function Baoform(props) {
  const [form] = useForm();

  useEffect(() => {
    // console.log("111", Form)
  });

  const onSubmit = () => {
    console.log('---');
  };

  const getAllValue = () => {};

  const onFinish = (val) => {
    console.log('onFinish', val); //sy-log
  };

  // 表单校验失败执行
  const onFinishFailed = (val) => {
    console.log('onFinishFailed', val); //sy-log
  };
  return (
    <div>
      Baoform
      <Form form={form} onFinish={onFinish} onFinishFailed={onFinishFailed}>
        <Field name="itemInput">
          <Input />
        </Field>
        <Field name="itemInput_2">
          <Input />
        </Field>

        <button onClick={getAllValue}> 获取 所有值 </button>
      </Form>
      <div>
        00
        <img src={require('../../img/1.jpg')} />
      </div>
    </div>
  );
}
